import React, { Component } from 'react'
import { Flex, Button } from 'react-vant';

//封装的组件
export default class Mytap extends Component {
    render() {
        let { data, dataIndex, setIndex } = this.props
        /* console.log(this.props); */

        return (
            <div>
                <Flex gutter={16} wrap='wrap'>
                    {
                        data.map((item,index) => {
                            return <Flex.Item span={6} key={index}>
                                <Button type={dataIndex==index?'primary':'default'} block round
                                 size='small' onClick={()=>{
                                    setIndex(index)
                                 }}
                                 >{item}</Button>
                            </Flex.Item>
                        })
                    }
                </Flex>
            </div>
        )
    }
}
